package com.android.kotlin.viewmodel

import android.app.Application
import android.arch.lifecycle.LiveData
import com.android.kotlin.bean.GankBean
import com.android.kotlin.base.BaseViewModel
import com.android.kotlin.repository.GrilRepository
import com.android.kotlin.util.Resource

/**
 * @Description:
 * @Author: xuwenlong
 * @Email: xuwenlong @ebrun.com
 * @Version:
 * @Create: 2019/2/28 0028
 * @Modify:
 */
class GrilViewModel(application: Application) :BaseViewModel<GrilRepository>(application){

    /**
     * 初始化-带缓存
     * */
    fun getInit(): LiveData<Resource<GankBean>> {
        return mRepository.getGril()
    }

    /**
     * 加载更多
     * */
    fun getMore(page:Int): LiveData<Resource<GankBean>> {
        return mRepository.getGirlList(page,false)
    }

    /**
     * 加载更多
     * */
    fun getRefresh(): LiveData<Resource<GankBean>> {
        return mRepository.getGirlList(0,false)
    }

}